package club.justwill.single.persistence.document;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by xiangnan on 16-1-14.
 */
@Document(collection = "stick")
public class Stick extends MongoDocument {
    @Field("user_id")
    @Indexed(name = "stick_user_id")
    private Long userId;

    @Field("project_id")
    @Indexed(name = "stick_project_id")
    private Long projectId;

    @Field("project_comments_list")
    private LinkedList<Comments> projectComments;

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getProjectId() {
        return projectId;
    }

    public void setProjectId(Long projectId) {
        this.projectId = projectId;
    }

    public LinkedList<Comments> getProjectComments() {
        if(projectComments == null) {
            projectComments = new LinkedList<Comments>();
        }
        return projectComments;
    }

    public void setProjectComments(List<Comments> projectComments) {
        this.projectComments = (LinkedList<Comments>) projectComments;
    }
}
